package com.lz.util;

import java.util.HashMap;
import java.util.Map;

public final class SQLConfig {

    private SQLConfig(){
    
        qryMap=new HashMap(5);
        qryMap.put("GETUSER",SQLConfig.GETUSER);
        qryMap.put("GETNEXT_ID",SQLConfig.GETNEXT_ID);
        qryMap.put("UPDATENEXT_ID",SQLConfig.UPDATENEXT_ID);
        
        qryMap.put("UPLOADGALLERY", sqlConfig.UPLOADGALLERY);
        qryMap.put("GET_ITEM_LIST", sqlConfig.GET_ITEM_LIST);
        
        qryMap.put("GET_ITEM_DESC", sqlConfig.GET_ITEM_DESC);
        qryMap.put("DELETE_ITEM", sqlConfig.DELETE_ITEM);
        
        qryMap.put("UPDATE_ITEM_DESC", sqlConfig.UPDATE_ITEM_DESC);
        
        
        
    }
    
    private static SQLConfig sqlConfig=new SQLConfig();
	private Map qryMap;
	private static final String GETUSER="select * from users where id=? AND password=? AND status=1";
    
       
	private static final String GETNEXT_ID="select id from sequence where type=?";
	private static final String UPDATENEXT_ID="update sequence set id=id+1 where type=?";
    //Gallery Maintain 
        private static final String UPLOADGALLERY="INSERT INTO item (shopid ,imageid ,description ,isbn,publisher,author,year,edition,price,name,categoryid) " +
        " VALUES(?,?,?,?,?,?,?,?,?,?,?)";
        
        private static final String GET_ITEM_LIST ="select imageid from  item WHERE shopid = ?  order by lastupdate desc limit 3";
        
        private static final String  DELETE_ITEM = "delete from item where shopid =? and imageid =?";
        
        private static final String  GET_ITEM_DESC = "select * from item where shopid =? and imageid =?  order by lastupdate desc";
        
        private static final String  UPDATE_ITEM_DESC = "UPDATE item SET description=?,isbn=?, publisher=?, author=?, year=?, edition=?, price=?,name=? where shopid =? and imageid =?";
       
    private Map getQueryMap(){return qryMap;}
    
    public static String getQuery(String key){
        return (String)sqlConfig.getQueryMap().get(key);
    }
    
}
